/*
 * Copyright (c) 2021. Moses All Right Reserved
 */

package com.moses.design_patterns.proxy.dynamic_proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author Moses
 * @email shenhuohui@gmail.com
 * @date 2021/4/10 22:59
 */
public class DynamicProxyHandler implements InvocationHandler {

    private Object target = null;
    public DynamicProxyHandler(Object target){
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        // 执行被代理类的方法
        return method.invoke(target, args);
    }
}
